package vo

import (
	"dc-news/common/global/consts"
	"dc-news/dao/model"
)

type AddChannelReq struct {
	Channel string `json:"channel"`
}

type RemoveChannelReq struct {
	Channel string `json:"channel"`
}

type GetNewsListResp struct {
	Code int                  `json:"code"`
	Msg  string               `json:"msg"`
	Data []model.NewsAbstract `json:"data"`
}

type GetNewsResp struct {
	Code int        `json:"code"`
	Msg  string     `json:"msg"`
	Data model.News `json:"data"`
}

type GetNewsInfoResp struct {
	Code int    `json:"code"`
	Msg  string `json:"msg"`
	Data struct {
		IsLikes      bool `json:"is_likes"`
		IsFavourites bool `json:"is_favourites"`
	} `json:"data"`
}

func NewGetNewsListResp(data *[]model.NewsAbstract) *GetNewsListResp {
	return &GetNewsListResp{
		Code: consts.OKCode,
		Msg:  "ok",
		Data: *data,
	}
}

func NewGetNews(data *model.News) *GetNewsResp {
	return &GetNewsResp{
		Code: consts.OKCode,
		Msg:  "ok",
		Data: *data,
	}
}

func NewGetNewsInfoResp(isLikes bool, isFavourite bool) *GetNewsInfoResp {
	return &GetNewsInfoResp{
		Code: consts.OKCode,
		Msg:  "ok",
		Data: struct {
			IsLikes      bool `json:"is_likes"`
			IsFavourites bool `json:"is_favourites"`
		}{
			IsLikes:      isLikes,
			IsFavourites: isFavourite,
		},
	}
}
